Skip to content

feat(editor): rewind an agent thread to before a message - #1229

Open
houko wants to merge 2 commits into
mainfrom
feat/editor-agent-rewind-1021
Open

houko wants to merge 2 commits into
mainfrom
feat/editor-agent-rewind-1021

Conversation

@houko

@houko houko commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Implements #1021 (docs/design/editor/Checkpoints.dc.html — Rewind the conversation · visible undo) using exclusively docs/design/editor/Spec.dc.html tokens in both Dark and Light appearances.

Summary

  • Per-turn file & scene checkpoints (packages/game/editor/agent_rewind.go, agent.go): captures symlink-safe pre-turn project file snapshots plus open scene / game.yaml snapshots on SubmitAgentPrompt, compacts changed-file deltas on turn completion/stop (AgentTurn.ChangedFiles, SessionIDBefore, SessionIDAfter), and synchronizes clean disk updates immediately into the open scene.
  • Rewind from any sent message with three choices (agent_ui.go, locales/{en,zh}.yaml): hovering or focusing any sent user message shows Rewind to here, opening the "Rewind to before this message" popover with:
    • Files and conversation (AgentRewindBoth, "Undo N files, drop the reply") — restores files from the turns' checkpoints, refreshes open scenes/tabs/files browser, drops later turns, and restores AgentSessionID to SessionIDBefore so subsequent requests continue from before the rewound message.
    • Files only (AgentRewindFilesOnly) — restores files while keeping the conversation thread and session intact.
    • Conversation only (AgentRewindConversationOnly) — drops later turns and rolls back session state while leaving files untouched.
  • Post-rewind banner, Redo, and composer return: returns the rewound message to the composer highlighted with the Spec accent ring (AgentComposerRewound), and displays a live-region status banner above the composer summarizing what was rewound with a Redo button (RedoAgentRewind) that restores files, thread turns, session ID, and prior composer draft.
  • Docs, changelog, and note: updated docs/en/editor.md and docs/zh/editor.md, added changelog.d/editor-agent-rewind-1021.md, and recorded the design note in .agents/notes/implemented/feature/2026-11-26-editor-agent-rewind.md.

Verification

  • env -u GOROOT go tool nsgo check ./editor & -target ios ./editor
  • env -u GOROOT go tool nsgo check ./editor/editorcmd & -target ios ./editor/editorcmd
  • TMPDIR=/tmp env -u GOROOT go tool nsgo test ./editor -run 'TestAgentRewind' -count=3 (15/15 passed)
  • TMPDIR=/tmp env -u GOROOT go tool nsgo test ./editor -run 'TestAgent|TestOpenFromTheFileBrowserOpensTabs|TestDiscardFollowsTheProjectBack|TestLightingHandlesAlignOnParallaxLayer|TestLocaleCatalogsComplete|TestDesktopMenuBarMatchesRegistryAndExecutesActions'
  • TMPDIR=/tmp env -u GOROOT go tool nsgo test ./editor/editormcp (41/41 passed)
  • Native macOS nsgo test -target macos -run TestAgentRewindMacOSScreenshots ./editor/editorcmd captured and visually inspected in both Dark and Light Spec appearances beside Checkpoints.dc.html
  • bun run verify-notes & env -u GOROOT go run ./tools/changelog check

Closes #1021

@github-actions github-actions Bot added documentation Improvements or additions to documentation pkg/editor area/agents size/XL conflict Conflicts with the target branch; resolve before merging enhancement New feature or request labels Nov 26, 2026
@houko
houko force-pushed the feat/editor-agent-rewind-1021 branch from 78f8342 to 098eaf4 Compare November 26, 2026 04:13
@github-actions github-actions Bot added conflict Conflicts with the target branch; resolve before merging and removed conflict Conflicts with the target branch; resolve before merging labels Nov 26, 2026
@houko
houko force-pushed the feat/editor-agent-rewind-1021 branch 2 times, most recently from e8fc9ad to 732c84a Compare November 26, 2026 04:51
@github-actions github-actions Bot added conflict Conflicts with the target branch; resolve before merging and removed conflict Conflicts with the target branch; resolve before merging labels Nov 26, 2026
@houko
houko force-pushed the feat/editor-agent-rewind-1021 branch from 732c84a to 1090fdb Compare November 26, 2026 11:16
@github-actions github-actions Bot added conflict Conflicts with the target branch; resolve before merging and removed conflict Conflicts with the target branch; resolve before merging labels Nov 26, 2026
@houko
houko force-pushed the feat/editor-agent-rewind-1021 branch from 1090fdb to 84bc8c5 Compare November 26, 2026 11:58
@github-actions github-actions Bot added conflict Conflicts with the target branch; resolve before merging and removed conflict Conflicts with the target branch; resolve before merging labels Nov 26, 2026
@houko
houko force-pushed the feat/editor-agent-rewind-1021 branch from 84bc8c5 to d8961bf Compare November 26, 2026 12:19
@github-actions github-actions Bot added conflict Conflicts with the target branch; resolve before merging and removed conflict Conflicts with the target branch; resolve before merging labels Nov 26, 2026
@houko
houko force-pushed the feat/editor-agent-rewind-1021 branch from d8961bf to d5338ed Compare November 26, 2026 12:31
@github-actions github-actions Bot added conflict Conflicts with the target branch; resolve before merging and removed conflict Conflicts with the target branch; resolve before merging labels Nov 26, 2026
@houko
houko force-pushed the feat/editor-agent-rewind-1021 branch from d5338ed to e65d63f Compare November 26, 2026 13:00
@houko
houko force-pushed the feat/editor-agent-rewind-1021 branch from e65d63f to 3c3da4e Compare November 26, 2026 13:05
@github-actions github-actions Bot removed the conflict Conflicts with the target branch; resolve before merging label Nov 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agents documentation Improvements or additions to documentation enhancement New feature or request pkg/editor size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editor: rewind an agent thread to before a message

1 participant